home *** CD-ROM | disk | FTP | other *** search
/ Info-Mac 4 / Info_Mac IV CD-ROM (Pacific HiTech Inc.)(August 1994).iso / Development / General / MM3MCp.sea Folder / Made by Marksman / Sources / mm / mmModalDialogObject.cp < prev    next >
Encoding:
Text File  |  1994-01-16  |  2.8 KB  |  107 lines  |  [TEXT/MMCC]

  1. /*  mmModalDialogObject                 */
  2. /*  Copyright © 1994 George R. Cossey */
  3.  
  4. /*    File name:  mmModalDialogObject
  5.     Function:  Basic modal dialog object
  6.  
  7.     History: 1/16/94 Original by George Cossey
  8.  
  9. */
  10.  
  11. #include "mmCommonMM_Demo.h"    /* Common */
  12. #include "CommonMM_Demo.h"        /* Common */
  13.  
  14.  
  15. /* ======================================================= */
  16. /* ======================================================= */
  17.  
  18. Boolean CmmModalDialog::FilterThisEvent(DialogPtr theDialog,EventRecord *theEvent,short *itemHit)
  19. {
  20. Boolean        FilterItOut;
  21. /* Expected to be overridden by the dialog code */
  22. FilterItOut = false;
  23. return(FilterItOut);
  24. }
  25.  
  26. /* ======================================================= */
  27.  
  28. void CmmModalDialog::FilterMouseDown(DialogPtr theDialog,EventRecord *theEvent,short *itemHit,Point MyPt)
  29. {
  30. /* Expected to be overridden by the dialog code */
  31. }
  32.  
  33. /* ======================================================= */
  34.  
  35. /* Routine: MyFilter */
  36. /* Purpose: Filter routine, also used for initial setup of dimmed states */
  37.  
  38. pascal Boolean theModalDialogFilter(DialogPtr theDialog,EventRecord *theEvent,short *itemHit)
  39. {
  40. Boolean            FilterValue;                            /* Temporary return value */
  41. Point            MyPt;
  42.  
  43.  
  44. FilterValue = false;
  45. if (gCurrentModalDialog != nil)
  46.     {
  47.     FilterValue = gCurrentModalDialog->FilterThisEvent(theDialog,theEvent,itemHit);
  48.     
  49.     /* Only do on an update */
  50.     if ((theEvent->what == updateEvt)  && ((WindowPtr)theEvent->message == theDialog))
  51.         {
  52.         BeginUpdate(theDialog);                        /* Start the update */
  53.         DrawDialog(theDialog);                        /* Draw the controls */
  54.         FilterValue = true;                            /* Pass out this special itemHit number */
  55.         *itemHit = 32000;                            /* Our special ID */
  56.         }
  57.     
  58.     if (theEvent->what == mouseDown)                /* Only do on a mouse click */
  59.         {
  60.         MyPt = theEvent->where;                        /* Get the point where the mouse was clicked */
  61.         GlobalToLocal(&MyPt);                        /* Convert global to local */
  62.  
  63.         gCurrentModalDialog->FilterMouseDown(theDialog,theEvent,itemHit,MyPt);
  64.         }
  65.     
  66.     CheckKeysInDialog(theDialog,&FilterValue,theEvent,itemHit);
  67.     }
  68.  
  69. return(FilterValue);
  70. }
  71.  
  72. /* ======================================================= */
  73.  
  74. void CmmModalDialog::Init()
  75. {
  76.  
  77. inherited::Init();
  78.  
  79. this->theWindow = nil;
  80. this->ExitDialog = false;
  81. /* Expected to be overridden by the dialog code */
  82. }
  83.  
  84. /* ======================================================= */
  85.  
  86. void CmmModalDialog::ExtraSetup()
  87. {
  88. /* Expected to be overridden by the dialog code */
  89. }
  90.  
  91. /* ======================================================= */
  92.  
  93. void CmmModalDialog::DoItemHit(short *itemHit,Boolean *ExitDialog)
  94. {
  95. /* Expected to be overridden by the dialog code */
  96. }
  97.  
  98. /* ======================================================= */
  99.  
  100. void CmmModalDialog::Exit()
  101. {
  102. /* Expected to be overridden by the dialog code */
  103. }
  104.  
  105. /* ======================================================= */
  106. /* ======================================================= */
  107.